<template>
  <div>
    <div class="info fx-r">
      <div class="avatar fx-h fx-bc fx-ac">
        <el-avatar :src="data.avatar" />
        <div>{{ data.mobile }}</div>
        <div style="color: #2b85e4">{{ data.nickname }}</div>
      </div>
      <div class="fx-g1" style="margin-left: 20px">
        <Row class="expand-row">
          <Col span="6">
            <span class="expand-key">注册:</span>
            <span class="expand-value" style="font-size: 10px">
              {{ data.regtime }}</span
            >
          </Col>

          <Col span="6">
            <span class="expand-key">登录:</span>
            <span class="expand-value" style="font-size: 10px">
              {{ data.lasttime }}</span
            >
          </Col>

          <Col span="6">
            <span class="expand-key">用户性别：</span>
            <span class="expand-value">
              <Icon
                type="md-male"
                v-show="data.sex === 1"
                color="#2db7f5"
                size="15"
                class="mr5"
              />
              <Icon
                type="md-female"
                v-show="data.sex === 2"
                color="#ed4014"
                size="15"
                class="mr5"
              />
              <span v-if="data.sex == 0">保密</span>
            </span>
          </Col>
          <Col span="6">
            <span class="expand-key">真实姓名：</span>
            <span class="expand-value">{{ data.name }}</span>
          </Col>
        </Row>

        <Row class="expand-row">
          <Col span="6">
            <span class="expand-key">团队：</span>
            <span class="expand-value">{{ data.mentor_name }}</span>
          </Col>

          <Col span="6">
            <span class="expand-key">推荐人：</span>
            <span
              class="expand-value"
              style="color: #0d6eff; cursor: pointer"
              v-if="data.i_uid > 0"
              @click="tapUserItem(data.i_uid)"
              >{{ data.i_name }}</span
            >
          </Col>

          <Col span="8">
            <span class="expand-key">身份证：</span>
            <span class="expand-value">{{ data.card }}</span>
          </Col>

          <Col span="4">
            <span class="expand-key">状态：</span>
            <span class="expand-value">
              <Tag v-if="data.status == 1" checkable color="success">正常</Tag>
              <Tag v-else checkable color="success">禁用</Tag>
            </span>
          </Col>
        </Row>
      </div>
    </div>

    <el-tabs
      tab-position="left"
      style="height: 450px"
      v-model="tabIndex"
      @tab-click="onClickTab"
    >
      <el-tab-pane label="订单记录" name="order">
        <div class="fx-r" style="padding: 20px 0">
          <el-input
            type="text"
            v-model="order.order_id"
            style="width: 200px; margin-right: 10px"
            placeholder="输入订单号"
          />

          <el-date-picker
            v-model="order.time"
            type="daterange"
            align="right"
            unlink-panels
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :picker-options="pickerOptions"
          >
          </el-date-picker>
          <el-button
            type="primary"
            style="margin-left: 6px"
            @click="tapOrderSeach"
            >查询</el-button
          >
        </div>

        <el-table
          :data="order.data"
          v-loading="order.loading"
          :stripe="true"
          :border="true"
          height="300px"
        >
          <el-table-column label="序号" align="center" width="50">
            <template slot-scope="scope">
              {{ (detial.page - 1) * detial.pageSize + scope.$index + 1 }}
            </template>
          </el-table-column>

          <el-table-column
            prop="order_id"
            label="订单号"
            align="center"
            width="150"
          >
          </el-table-column>

          <el-table-column prop="type_name" label="订单类型" width="80">
          </el-table-column>

          <el-table-column prop="time" label="下单时间" width="140">
          </el-table-column>

          <el-table-column prop="all_price" label="订单金额" width="80">
            <template slot-scope="scope"> ￥{{ scope.row.allmoney }} </template>
          </el-table-column>

          <el-table-column prop="all_price" label="潮豆抵扣" width="120">
            <template slot-scope="scope"> ￥{{ scope.row.credits }} </template>
          </el-table-column>

          <el-table-column prop="all_price" label="实际支付" width="80">
            <template slot-scope="scope">
              ￥{{ scope.row.pay_money }}
            </template>
          </el-table-column>

          <el-table-column prop="all_price" label="可获燃料/潮豆" width="200">
            <template slot-scope="scope">
              {{ scope.row.ticket_value }}/ {{ scope.row.creadits_value }}
            </template>
          </el-table-column>

          <el-table-column
            prop="name"
            label="收件人"
            align="center"
            width="100"
          >
          </el-table-column>

          <el-table-column
            prop="tel"
            label="收件电话"
            align="center"
            width="100"
          >
          </el-table-column>

          <el-table-column
            prop="address"
            label="收件地址"
            align="center"
            width="260"
          >
          </el-table-column>

          <el-table-column label="订单状态" fixed="right" width="80">
            <template slot-scope="scope">
              <div class="fx-r fx-bc" v-if="scope.row.status == -1">
                <div class="circle color4"></div>
                <span>已取消</span>
              </div>

              <div class="fx-r fx-bc" v-if="scope.row.status == 0">
                <div class="circle color1"></div>
                <span>待支付</span>
              </div>

              <div class="fx-r fx-bc" v-if="scope.row.status == 1">
                <div class="circle color2"></div>
                <span>未发货</span>
              </div>

              <div class="fx-r fx-bc" v-if="scope.row.status == 2">
                <div class="circle color3"></div>
                <span>待收货</span>
              </div>

              <div class="fx-r fx-bc" v-if="scope.row.status == 3">
                <div class="circle color4"></div>
                <span>已收货</span>
              </div>

              <div class="fx-r fx-bc" v-if="scope.row.status == 9">
                <div class="circle color5"></div>
                <span>异常</span>
              </div>
            </template>
          </el-table-column>
        </el-table>

        <div class="acea-row row-right page">
          <Page
            :total="order.pageCount"
            show-elevator
            show-total
            @on-change="tapOrderlPage"
            :page-size="order.pageSize"
          />
        </div>
      </el-tab-pane>

      <el-tab-pane label="推荐关系" name="about">
        <div class="fx-r">
          <el-input
            type="text"
            v-model="about.mobile"
            style="width: 200px; margin-right: 10px"
            placeholder="请收入用户手机号码"
          />
          <el-button
            type="primary"
            style="margin-left: 6px"
            @click="tapAboutSeach"
            >查询</el-button
          >
        </div>

        <div class="tab-select">
          <a
            @click="tapAboutLevelTabs(-1)"
            href="javascript:;"
            :class="about.levelIndex == -1 ? 'active' : ''"
            >全部</a
          >
          <a
            @click="tapAboutLevelTabs(index)"
            href="javascript:;"
            :class="about.levelIndex == index ? 'active' : ''"
            v-for="(item, index) in about.levelData"
            :key="index"
            >{{ item.name + '(' + item.member_count + ')' }}
          </a>
        </div>

        <div class="tab-select">
          <a
            @click="tapAboutTabs(-1)"
            href="javascript:;"
            :class="about.mentorIndex == -1 ? 'active' : ''"
            >全部</a
          >
          <a
            @click="tapAboutTabs(index)"
            href="javascript:;"
            :class="about.mentorIndex == index ? 'active' : ''"
            v-for="(item, index) in about.mentorData"
            :key="index"
            >{{ item.name + '(' + item.member_count + ')' }}</a
          >
        </div>
        <el-table
          :data="about.data"
          v-loading="about.loading"
          :stripe="true"
          :border="true"
          height="280px"
        >
          <el-table-column label="序号" align="center" width="50">
            <template slot-scope="scope">
              {{ (detial.page - 1) * detial.pageSize + scope.$index + 1 }}
            </template>
          </el-table-column>

          <el-table-column prop="name" label="姓名" align="center" width="100">
          </el-table-column>

          <el-table-column prop="nickname" label="手机号码" width="120">
            <template slot-scope="scope">
              <div
                class="fx-r"
                style="color: #0d6eff; cursor: pointer"
                @click="tapUserItem(scope.row.uid)"
              >
                <div>{{ scope.row.nickname }}</div>
              </div>
            </template>
          </el-table-column>

          <el-table-column
            prop="total_count"
            label="团队人员"
            align="center"
            width="80"
          >
          </el-table-column>

          <el-table-column
            prop="performance_money"
            label="业绩"
            align="center"
            width="80"
          >
          </el-table-column>

          <el-table-column
            prop="runntotal_money"
            label="流水"
            align="center"
            width="80"
          >
            <template slot-scope="scope">
              {{ scope.row.runntotal_money || 0 }}
            </template>
          </el-table-column>

          <el-table-column
            prop="mentor_name"
            label="星级"
            align="center"
            width="100"
          >
          </el-table-column>

          <el-table-column prop="regtime" label="加入时间" width="150">
          </el-table-column>
        </el-table>
        <div class="acea-row row-right page">
          <Page
            :total="about.pageCount"
            show-elevator
            show-total
            @on-change="tapAboutPage"
            :page-size="about.pageSize"
          />
        </div>
      </el-tab-pane>
    </el-tabs>

    <!--修改会员-->
    <Modal
      draggable
      scrollable
      :title="user.title"
      v-model="dialogVisible"
      width="600px"
    >
      <el-form ref="user" :model="user" label-width="80px">
        <el-form-item label="类型">
          <el-radio-group v-model="user.type">
            <el-radio :label="1">增加</el-radio>
            <el-radio :label="2">减少</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item
          label="数量"
          prop="v"
          :rules="[{ required: true, message: '请输入数量' }]"
        >
          <el-input
            placeholder="请输入数量"
            autocomplete="off"
            v-model="user.v"
          ></el-input>
        </el-form-item>

        <el-form-item label="说明">
          <el-input
            type="textarea"
            placeholder="请输入操作说明"
            autocomplete="off"
            v-model="user.mono"
          ></el-input>
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="onSubmit">确 定</el-button>
      </span>
    </Modal>
  </div>
</template>

<script>
import { mapState, mapActions } from 'vuex'

export default {
  name: 'userInfo',
  computed: {
    ...mapState('system/user', ['info', 'paths']),
  },
  data() {
    return {
      data: {},
      tabIndex: 'order',
      uid: 0,
      pickerOptions: {
        shortcuts: [
          {
            text: '最近一周',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end])
            },
          },
          {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end])
            },
          },
          {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end])
            },
          },
        ],
      },
      dialogVisible: false,
      user: {
        title: '',
        type: '1',
        v: '',
        mono: '',
        tabName: '',
      },
      detial: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        time: '',
        loading: true,
        data: [],
      },
      order: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        order_id: '',
        time: '',
        loading: true,
        data: [],
      },
      about: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        loading: true,
        data: [],
        mentorIndex: -1,
        mentorData: [],
        levelIndex: [],
        levelData: [],
      },
      ticket: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
      },
      nergy: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
      },
      credits: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
        total: 0,
        jtotal: 0,
      },
      active: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
        total: 0,
        jtotal: 0,
      },
      weipai: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
        total: 0,
        jtotal: 0,
      },
      contribution: {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        mobile: '',
        time: [],
        loading: true,
        data: [],
        total: 0,
        jtotal: 0,
      },
    }
  },
  created() {},
  methods: {
    initView: function (uid) {
      this.uid = uid
      this.order = this.$utils.resetFields(this.order, {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        data: [],
        loading: '',
      })
      this.about = this.$utils.resetFields(this.about, {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        data: [],
        loading: '',
        mentorIndex: -1,
        levelIndex: -1,
        levelData: [],
      })
      this.detial = this.$utils.resetFields(this.detial, {
        page: 1,
        pageSize: 0,
        pageCount: 0,
        data: [],
        loading: '',
      })
      this.initUser()
      this.onClickTab({ name: this.tabIndex })
      //
    },

    initUser: function () {
      SystemMemberItem({ uid: this.uid })
        .then((res) => {
          this.loading = false
          if (res.code == 200) {
            this.data = res.data
          } else {
            this.$alert(res.msg)
          }
        })
        .catch((err) => {
          this.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    onClickTab: function (ev) {
      if (ev.name == 'order') {
        this.getOrderList()
      }
      //推广人
      if (ev.name == 'about') {
        this.getAboutInit()
        this.getAboutList()
      }

      //ticket
      if (ev.name == 'ticket') {
        this.geTicketList()
      }

      //营业值
      if (ev.name == 'active') {
        this.getActiveList()
      }

      //红包
      if (ev.name == 'credits') {
        this.getCreditsList()
      }

      //代理金
      if (ev.name == 'weipai') {
        this.getWeipaiList()
      }
      //贡献值
      if (ev.name == 'contribution') {
        this.geContributionList()
      }
    },

    /**
     * 分页
     */
    tapDetialPage: function (page) {
      this.detial.page = page
      this.getDetail()
    },
    tapInfoSeach: function () {
      this.detial.page = 1
      this.getDetail()
    },
    /**
     *
     */
    getDetail: function () {
      var data = {}
      this.detial.loading = true
      data.page = this.detial.page
      data.uid = this.uid
      data.time = this.detial.time
      SystemDetailList(data)
        .then((res) => {
          this.detial.loading = false
          this.detial.data = res.data.list
          this.detial.pageSize = res.data.pageSize
          this.detial.pageCount = res.data.pageCount
        })
        .catch((err) => {
          this.detial.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 订单数据
     */
    getOrderList: function () {
      var data = {}
      this.order.loading = true
      data.page = this.order.page
      data.uid = this.uid
      data.order_id = this.order.order_id
      data.data = this.order.time
      SystemOrderList(data)
        .then((res) => {
          this.order.loading = false
          this.order.data = res.data.list
          this.order.pageSize = res.data.pageSize
          this.order.pageCount = res.data.pageCount
        })
        .catch((err) => {
          this.order.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 分页
     */
    tapOrderlPage: function (page) {
      this.order.page = page
      this.getOrderList()
    },
    tapOrderSeach: function () {
      this.order.page = 1
      this.getOrderList()
    },

    /******************************* [推荐人] *********************/

    /**
     * 推荐人星级数量
     */
    getAboutInit: function () {
      var promiseAll = []
      promiseAll.push(SystemMemberMentorCount({ uid: this.uid }))
      promiseAll.push(SystemMemberLevelCount({ uid: this.uid }))
      Promise.all(promiseAll)
        .then((res) => {
          if (res[0].code == 200) {
            this.about.mentorData = res[0].data
          }
          if (res[1].code == 200) {
            this.about.levelData = res[1].data
          }
        })
        .catch((err) => {})
    },
    /**
     * 推荐人数据
     */
    getAboutList: function () {
      var data = {}
      this.about.loading = true
      data.page = this.about.page
      data.i_uid = this.uid
      data.mobile = this.about.mobile
      if (this.about.mentorIndex >= 0) {
        data.mentor_id = this.about.mentorData[this.about.mentorIndex].id
      }
      if (this.about.levelIndex >= 0) {
        data.levelid = this.about.levelData[this.about.levelIndex].id
      }
      SystemMember(data)
        .then((res) => {
          this.about.loading = false
          this.about.data = res.data.list
          this.about.pageSize = res.data.pageSize
          this.about.pageCount = res.data.pageCount
        })
        .catch((err) => {
          this.about.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 分页
     */
    tapAboutPage: function (page) {
      this.about.page = page
      this.getAboutList()
    },
    /**
     * 切换状态
     */
    tapAboutTabs: function (index) {
      this.about.mentorIndex = index
      this.about.page = 1
      this.getAboutList()
    },
    /**
     * 切换等级
     */
    tapAboutLevelTabs: function (index) {
      this.about.levelIndex = index
      this.about.page = 1
      this.getAboutList()
    },

    tapAboutSeach: function () {
      this.about.page = 1
      this.getAboutList()
    },

    tapUserItem: function (uid) {
      setTimeout(() => {
        this.$emit('userItem', uid)
      }, 200)
    },

    /******************************* [创业值] *********************/

    geTicketList: function () {
      var data = {}
      this.ticket.loading = true
      data.page = this.ticket.page
      data.time = this.ticket.time
      data.uid = this.uid
      SystemDetailTicketList(data)
        .then((res) => {
          this.ticket.loading = false
          this.ticket.data = res.data.list
          this.ticket.pageSize = res.data.pageSize
          this.ticket.pageCount = res.data.pageCount
          this.ticket.total = res.data.total
          this.ticket.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.ticket.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapTicketSeach: function () {
      this.ticket.page = 1
      this.geTicketList()
    },
    /**
     * 分页
     * @param page
     */
    tapTicketPage: function (page) {
      this.ticket.page = page
      this.geTicketList()
    },

    /******************************* [贡献值] *********************/
    /**
     * 推荐人数据
     */
    getNergyList: function () {
      var data = {}
      this.nergy.loading = true
      data.page = this.nergy.page
      data.time = this.nergy.time
      data.uid = this.uid
      SystemDetailNergyList(data)
        .then((res) => {
          this.nergy.loading = false
          this.nergy.data = res.data.list
          this.nergy.pageSize = res.data.pageSize
          this.nergy.pageCount = res.data.pageCount
          this.nergy.total = res.data.total
          this.nergy.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.nergy.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapNergySeach: function () {
      this.nergy.page = 1
      this.getNergyList()
    },
    /**
     * 分页
     * @param page
     */
    tapNergyPage: function (page) {
      this.nergy.page = page
      this.getNergyList()
    },

    /***********[学分值] ***********************/
    //学分值
    getCreditsList: function () {
      var data = {}
      this.credits.loading = true
      data.page = this.credits.page
      data.time = this.credits.time
      data.uid = this.uid
      SystemDetailCreditsList(data)
        .then((res) => {
          this.credits.loading = false
          this.credits.data = res.data.list
          this.credits.pageSize = res.data.pageSize
          this.credits.pageCount = res.data.pageCount
          this.credits.total = res.data.total
          this.credits.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.nergy.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapCreditsSeach: function () {
      this.credits.page = 1
      this.getCreditsList()
    },
    /**
     * 分页
     * @param page
     */
    tapCreditsPage: function (page) {
      this.credits.page = page
      this.getCreditsList()
    },

    /***********[贡献值] ***********************/
    //贡献值
    getActiveList: function () {
      var data = {}
      this.active.loading = true
      data.page = this.active.page
      data.time = this.active.time
      data.uid = this.uid
      SystemDetailActiveList(data)
        .then((res) => {
          this.active.loading = false
          this.active.data = res.data.list
          this.active.pageSize = res.data.pageSize
          this.active.pageCount = res.data.pageCount
          this.active.total = res.data.total
          this.active.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.active.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapActiveSeach: function () {
      this.active.page = 1
      this.getActiveList()
    },
    /**
     * 分页
     * @param page
     */
    tapActivePage: function (page) {
      this.active.page = page
      this.getActiveList()
    },

    /***********[成长值] ***********************/
    //贡献值
    getWeipaiList: function () {
      var data = {}
      this.weipai.loading = true
      data.page = this.weipai.page
      data.time = this.weipai.time
      data.uid = this.uid
      SystemDetailWeipaiList(data)
        .then((res) => {
          this.weipai.loading = false
          this.weipai.data = res.data.list
          this.weipai.pageSize = res.data.pageSize
          this.weipai.pageCount = res.data.pageCount
          this.weipai.total = res.data.total
          this.weipai.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.weipai.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapWeipaiSeach: function () {
      this.weipai.page = 1
      this.getWeipaiList()
    },
    /**
     * 分页
     * @param page
     */
    tapWeipaiPage: function (page) {
      this.weipai.page = page
      this.getWeipaiList()
    },

    /***********[贡献值] ***********************/
    //贡献值
    geContributionList: function () {
      var data = {}
      this.contribution.loading = true
      data.page = this.contribution.page
      data.time = this.contribution.time
      data.uid = this.uid
      SystemDetailContributionList(data)
        .then((res) => {
          this.contribution.loading = false
          this.contribution.data = res.data.list
          this.contribution.pageSize = res.data.pageSize
          this.contribution.pageCount = res.data.pageCount
          this.contribution.total = res.data.total
          this.contribution.jtotal = res.data.jtotal
        })
        .catch((err) => {
          this.contribution.loading = false
          this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
        })
    },
    /**
     * 搜索栏目
     */
    tapContributionSeach: function () {
      this.contribution.page = 1
      this.geContributionList()
    },
    /**
     * 分页
     * @param page
     */
    tapContributionPage: function (page) {
      this.contribution.page = page
      this.geContributionList()
    },

    tapAd: function (tabName, title) {
      this.user = this.$utils.resetFields(this.user, { type: 1 })
      this.user.title = title
      this.user.tabName = tabName
      this.dialogVisible = true
    },

    onSubmit: function () {
      this.$refs['user'].validate((valid) => {
        if (valid) {
          this.$utils.loading(this, '提交数据中...')
          var post = {}
          post.uid = this.uid
          post.v = this.user.v
          post.mono = this.user.mono
          post.type = this.user.type
          var libHttp = {}
          if (this.user.tabName == 'nergy') {
            libHttp = SystemDetailNergySave(post)
          }
          if (this.user.tabName == 'credits') {
            libHttp = SystemDetailCreditsSave(post)
          }
          if (this.user.tabName == 'active') {
            libHttp = SystemDetailActiveSave(post)
          }
          if (this.user.tabName == 'weipai') {
            libHttp = SystemDetailWeipaiSave(post)
          }
          if (this.user.tabName == 'ticket') {
            libHttp = SystemDetailTicketSave(post)
          }

          if (this.user.tabName == 'contribution') {
            libHttp = SystemDetailContributionSave(post)
          }

          libHttp
            .then((res) => {
              this.$utils.loadingClose()
              if (res.code == 200) {
                this.$message({
                  message: res.msg,
                  type: 'success',
                })
                this.onClickTab({ name: this.tabIndex })
                this.initUser()
                this.dialogVisible = false
              } else {
                this.$alert(res.msg)
              }
            })
            .catch((err) => {
              this.$utils.loadingClose()
              this.$alert('网络繁忙，加载失败，请稍等片刻在尝试!', '系统提示')
            })
        }
      })
    },
  },
}
</script>
<style scoped>
.info .avatar {
  margin-left: 20px;
}

.expand-row {
  padding: 10px 0;
}
.tab-select a {
  color: #606266;
  padding: 10px 0;
  padding-right: 12px;
  display: inline-block;
}
.tab-select a.active {
  color: #0d6eff;
}
</style>
